<html>
<body style="color: #000;">
<?php

require_once '../../theGridPaper/library/GridLayouter.php';

$layouter = new GridLayouter();

$gridSize = new Size(7, 5);

$newnits = $layouter->layout(array(
    new GridEntry(0.8, "toto"),
    new GridEntry(0.6, "toto"),
    new GridEntry(0.5, "toto"),
    new GridEntry(0.4, "toto"),
    new GridEntry(0.3, "toto"),
    new GridEntry(0.2, "toto"),
    new GridEntry(0.1, "toto")), $gridSize);
//print_r($newnits);


for ($y = 0; $y < $gridSize->height; $y++)
{
    for ($x = 0; $x < $gridSize->width; $x++)
    {
        
    	echo '<div style="position: absolute; left: '.($x * 100);
    	echo 'px; top: '.($y * 100);
    	echo 'px; width: 100px';
    	echo '; height: 100px';

        echo '; border: 1px solid #EEE';
    	
    	echo ';"></div>';
    }
}


foreach ($newnits as $nn)
{
    $b = $nn->bounds;
	echo '<div style="position: absolute; left: '.($b->location->x * 100);
	echo 'px; top: '.($b->location->y * 100);
	echo 'px; width: '.($b->size->width * 100);
	echo 'px; height: '.($b->size->height * 100);

    echo 'px; border: 1px solid #000';
	
	echo ';">'.$nn->gridEntry->weight.'</div>';

}

?>
</body>
</html>
